home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 62 / Quick PC 62.iso / Programs / Ipswitch.IMail.Server.Pro.8.0.Winall / IMail8ec.exe / data1.cab / Web_Standard / functions.cgi < prev    next >
Encoding:
Text File  |  2003-05-07  |  11.1 KB  |  408 lines

  1.   var current;
  2.   var menu     = "Goto the main menu";
  3.   var compose  = "Compose an email";
  4.   var asearch  = "Search through your existing emails";
  5.   var logout   = "Logout of your account";
  6.   var check    = "Click here to check all boxes";
  7.   var CSSstatus = "0";
  8.   var CSSObject = 'menuOptions';
  9.   var CSSselect = "Compose a message to:";
  10.   // convert all characters to lowercase to simplify testing 
  11.   var agt=navigator.userAgent.toLowerCase();
  12.   // Note: On IE5, these return 4, so use is_ie5up to detect IE5. 
  13.   var is_major = parseInt(navigator.appVersion); 
  14.   var is_minor = parseFloat(navigator.appVersion); 
  15.   var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) 
  16.                 && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) 
  17.                 && (agt.indexOf('webtv')==-1)); 
  18.   var is_nav3 = (is_nav && (is_major == 3));
  19.   var is_nav4up = (is_nav && (is_major >= 4));
  20.   var is_ie   = (agt.indexOf("msie") != -1);
  21.   var is_ie4up  = (is_ie  && (is_major >= 4));
  22.  
  23.   if(is_nav4up)
  24.   {
  25.     CSSObject += 'NS';
  26.   }
  27.  
  28.   function statusBarMsg(message)
  29.   {
  30.     window.status = message;
  31.   }
  32.  
  33.   function chgTextBox(form)
  34.   {
  35.     var i;
  36.     var newOpt = "<!--IMAIL.RuleNewMailbox-->";
  37.     var deleteOpt = "<!--IMAIL.RuleDeleteMail-->";
  38.  
  39.     i = form.subarea.selectedIndex;
  40.   
  41.     if(i==-1)
  42.     {
  43.       return;
  44.     }
  45.  
  46.     if(form.subarea.options[i].text==newOpt)
  47.     {
  48.       form.newMbxName.value="";
  49.       form.newMbxName.focus();
  50.       return;
  51.     }
  52.     if(form.subarea.options[i].text==deleteOpt)
  53.     {
  54.       form.newMbxName.value="Delete the message";
  55.       return;
  56.     }
  57.     else
  58.     {
  59.       form.newMbxName.value=form.subarea.options[i].text;
  60.       return;
  61.     }
  62.   }
  63.  
  64.   function doButton(sButton)
  65.   {
  66.     if (sButton == "<!--IMAIL.SearchButton-->"
  67.         || sButton == "<!--IMAIL.CancelButton-->")
  68.       document.Search.search_ok.value = sButton;
  69.       document.Search.submit();
  70.   }
  71.  
  72.   function doButton2(TopBottom,sButton)
  73.   {
  74.     if (sButton=="<!--IMAIL.NextButton-->"
  75.         || sButton=="<!--IMAIL.PreviousButton-->"
  76.         || sButton=="<!--IMAIL.ReplyButton-->"
  77.         || sButton=="<!--IMAIL.ReplyAllButton-->"
  78.         || sButton=="<!--IMAIL.ForwardButton-->"
  79.         || sButton=="<!--IMAIL.DeleteButton-->"
  80.         || sButton=="<!--IMAIL.MoveToButton-->")
  81.     {
  82.       if (TopBottom=="Top")
  83.       {
  84.         document.Buttons.imail_action.value=sButton;
  85.         document.Buttons.submit();
  86.       }
  87.       if (TopBottom=="Move")
  88.       {
  89.         document.MoveButton.imail_action.value=sButton;
  90.         document.MoveButton.submit();
  91.       }
  92.       if (TopBottom=="Bottom")
  93.       {
  94.         document.BottomButtons.imail_action.value=sButton;
  95.         document.BottomButtons.submit();
  96.       }
  97.       return;
  98.     }
  99.   }
  100.  
  101.   function doButton3(sButton)
  102.   {
  103.     if (sButton=="Top<!--IMAIL.NextPageButton-->"
  104.        || sButton=="Top<!--IMAIL.LastPageButton-->"
  105.        || sButton=="Top<!--IMAIL.GoPageButton-->"
  106.        || sButton=="Top<!--IMAIL.FirstPageButton-->"
  107.        || sButton=="Top<!--IMAIL.PriorPageButton-->"
  108.        || sButton=="<!--IMAIL.NextPageButton-->"
  109.        || sButton=="<!--IMAIL.LastPageButton-->"
  110.        || sButton=="<!--IMAIL.GoPageButton-->"
  111.        || sButton=="<!--IMAIL.FirstPageButton-->"
  112.        || sButton=="<!--IMAIL.PriorPageButton-->")
  113.     {
  114.       var nCounter = document.forms.length;
  115.       var nForms   = 0;
  116.       while (nForms < nCounter)
  117.       {
  118.         if (document.forms[nForms].name == sButton)
  119.         {
  120.           document.forms[nForms].submit();
  121.         }
  122.           nForms++
  123.       }
  124.     } else if (sButton=="<!--IMAIL.DeleteButton-->"
  125.               || sButton=="<!--IMAIL.DeleteAllButton-->"
  126.               || sButton=="<!--IMAIL.MoveToButton-->"
  127.               || sButton=="<!--IMAIL.GotoMailboxButton-->")
  128.       {
  129.         document.mboxsummary.imail_action.value=sButton;
  130.         document.mboxsummary.submit();
  131.         return;
  132.       }
  133.   }
  134.  
  135.   function newMailCount(data, NumValue)
  136.   {
  137.     if(NumValue==1)
  138.     {
  139.       if(data.split("/"))
  140.       {
  141.         countArray = new Array(2);
  142.         countArray = data.split("/");
  143.         if(countArray[1] > 0)
  144.         {
  145.           document.write("(" + countArray[1] + ")");
  146.         }
  147.           return;
  148.       }
  149.       else
  150.       {
  151.         return;
  152.       }
  153.     }
  154.     if(NumValue==0)
  155.     {
  156.       if(data.split("/"))
  157.       {
  158.         countArray = new Array(2);
  159.         countArray = data.split("/");
  160.         document.write(countArray[0]);
  161.         return;
  162.       }
  163.       else
  164.       {
  165.         document.write(data);
  166.         return;
  167.       }
  168.     }
  169.   }
  170.  
  171.   function checkAll()
  172.   {
  173.     for (var i=0;i<document.mboxsummary.elements.length;i++)
  174.     {
  175.       var e = document.mboxsummary.elements[i];
  176.       var boolValue = document.sortedsummary.selectAll.checked;
  177.       if (e.name != 'selectAll')
  178.       {
  179.         e.checked = boolValue;
  180.       }
  181.     }
  182.   }
  183.  
  184.   function goToPage(numPages, curr, type)
  185.   {
  186.     var counter;
  187.     var maxCount;
  188.     document.write('<SELECT NAME="gotopage" SIZE="1" VALIGN="top" onChange="doButton3(');
  189.     document.write("'" + type + "'");
  190.     document.write(');">');
  191.     for(counter=1,maxCount=numPages; maxCount > 0; maxCount--,counter++)
  192.     {
  193.       if(counter == curr)
  194.       {
  195.         document.writeln('<OPTION VALUE="' + counter + '" SELECTED>' + counter + '</OPTION>');
  196.       }
  197.       else
  198.       {
  199.         document.writeln('<OPTION VALUE="' + counter + '">' + counter + '</OPTION>');
  200.       }
  201.     }
  202.     document.writeln('</SELECT>');
  203.   }
  204.  
  205.   function newMsgCount()
  206.   { 
  207.     if(<!--IMAIL.UnreadMessageCount-->>0)
  208.     {
  209.       <!--IMAIL.BeginIsMailbox.EQ Draft-->
  210.         document.writeln('<FONT SIZE="2" FACE="Arial, Helvetica"><B><!--IMAIL.UnreadMessageCount--> unread draft(s)</B></FONT>');
  211.       <!--IMAIL.ElseBeginIsMailbox-->
  212.        document.writeln('<FONT SIZE="2" FACE="Arial, Helvetica"><B><!--IMAIL.UnreadMessageCount--> unread message(s)</B></FONT>');
  213.       <!--IMAIL.EndBeginIsMailbox-->
  214.     }
  215.     else
  216.     {
  217.       <!--IMAIL.BeginIsMailbox.EQ Draft-->
  218.         document.writeln('<FONT SIZE="2" FACE="Arial, Helvetica">No new draft.</FONT>');
  219.       <!--IMAIL.ElseBeginIsMailbox-->
  220.         document.writeln('<FONT SIZE="2" FACE="Arial, Helvetica">No new message.</FONT>');
  221.       <!--IMAIL.EndBeginIsMailbox-->
  222.     }
  223.   }
  224.  
  225.   function deleteMe(num)
  226.   {
  227.     for (var i=0;i<document.mboxsummary.elements.length;i++)
  228.     {
  229.       var me = document.mboxsummary.elements[i];
  230.       if (me.name == 'msgsort' && me.value == num)
  231.       {
  232.         me.checked = true;
  233.       }
  234.       else
  235.       {
  236.         me.checked = false;
  237.       }
  238.     }
  239.     doButton3('<!--IMAIL.DeleteButton-->');
  240.   }
  241.  
  242.   function selectMe(me, match)
  243.   {
  244.     var maxNum, counter, choice;
  245.     maxNum = me.length;
  246.     for (counter=0; counter<maxNum; counter++)
  247.     {
  248.       choice = me.options[counter];
  249.       if(choice.text==match)
  250.       {
  251.         choice.selected=1;
  252.         return;
  253.       }
  254.     }
  255.     return;
  256.   }
  257.  
  258.   function selectMailbox(mailbox)
  259.   {
  260.     var maxNum, counter, choice;
  261.     maxNum = document.ModRul.subarea.length;
  262.     for (counter=0; counter<maxNum; counter++)
  263.     {
  264.       choice = document.ModRul.subarea.options[counter];
  265.       if(choice.text==mailbox)
  266.       {
  267.         choice.selected=1;
  268.         return;
  269.       }
  270.       if(mailbox=="NUL")
  271.       {
  272.         document.ModRul.subarea.options[1].selected=1;
  273.         document.ModRul.newMbxName.value="";
  274.         return;
  275.       }
  276.     }
  277.     document.ModRul.subarea.options[0].selected=1;
  278.     return;
  279.   }
  280.  
  281.   <!--IMAIL.BeginIfUserIcalendarEnable-->
  282.   function openIWebCal()
  283.   { 
  284.     <!--IMAIL.BeginSSL-->    
  285.         <!--IMAIL.BeginIfCurrentDomainIsAVirtualDomain-->
  286.           newWindow = open("https://<!--IMAIL.PrimaryDomain-->:<!--IMAIL.ICalSSLServerPort-->/ical.cgi?&App=ICalMsg&<!--IMAIL.UserParameters-->",
  287.             "Calendar", "toolbar=yes,location=1,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=1,copyhistory=1,width=512,height=512");
  288.         <!--IMAIL.ElseBeginIfCurrentDomainIsAVirtualDomain-->
  289.           newWindow = open("https://<!--IMAIL.CurrentDomain-->:<!--IMAIL.ICalSSLServerPort-->/ical.cgi?&App=ICalMsg&<!--IMAIL.UserParameters-->",
  290.             "Calendar", "toolbar=yes,location=1,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=1,copyhistory=1,width=512,height=512");
  291.         <!--IMAIL.EndBeginIfCurrentDomainIsAVirtualDomain-->
  292.     <!--IMAIL.ElseBeginSSL-->
  293.         <!--IMAIL.BeginIfCurrentDomainIsAVirtualDomain-->
  294.           newWindow = open("http://<!--IMAIL.PrimaryDomain-->:<!--IMAIL.ICalServerPort-->/ical.cgi?&App=ICalMsg&<!--IMAIL.UserParameters-->",
  295.             "Calendar", "toolbar=yes,location=1,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=1,copyhistory=1,width=512,height=512");
  296.         <!--IMAIL.ElseBeginIfCurrentDomainIsAVirtualDomain-->
  297.           newWindow = open("http://<!--IMAIL.CurrentDomain-->:<!--IMAIL.ICalServerPort-->/ical.cgi?&App=ICalMsg&<!--IMAIL.UserParameters-->",
  298.             "Calendar", "toolbar=yes,location=1,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=1,copyhistory=1,width=512,height=512");
  299.         <!--IMAIL.EndBeginIfCurrentDomainIsAVirtualDomain-->
  300.     <!--IMAIL.EndBeginSSL-->
  301.   }
  302.  
  303.   <!--IMAIL.EndBeginIfUserIcalendarEnable-->
  304.  
  305.     function writeTextBox(form)
  306.     {
  307.       i = form.Target.selectedIndex;
  308.       if((form.Target.options[i].text.search("@")!=-1) && (i != -1))
  309.       {
  310.         form.newaddr.value = form.Target.options[i].text;
  311.       }
  312.     }
  313.  
  314.     function findMe(formList, textBoxValue)
  315.     {
  316.       if(textBoxValue.charAt(0)=='<' && textBoxValue.charAt(textBoxValue.length - 1)=='>')
  317.       {
  318.         selectMe(formList, textBoxValue);
  319.       }
  320.  
  321.       if(textBoxValue.charAt(0)!='<' && textBoxValue.charAt(textBoxValue.length - 1)!='>')
  322.       {
  323.         textBoxValue = '<' + textBoxValue + '>';
  324.         selectMe(formList, textBoxValue);
  325.       }
  326.  
  327.       return;
  328.     }
  329.  
  330.     function searchaddr(form, searchtext, listName)
  331.     {
  332.  
  333.       var i = 0;
  334.       var quote = '"';
  335.  
  336.       if(searchtext == "")
  337.       {
  338.         alert("The text field for the " + listName + " is blank.");
  339.         return;
  340.       }
  341.  
  342.       for(i=0; i< form.Target.length; i++)
  343.       {
  344.  
  345.         if(form.Target.options[i].text == searchtext )
  346.         {    
  347.            form.Target.selectedIndex = i;
  348.           return;
  349.         }
  350.         else
  351.         {
  352.           if(form.Target.options[i].text.indexOf(searchtext) != -1)
  353.           {    
  354.              form.Target.selectedIndex = i;
  355.             return;
  356.           }
  357.         }
  358.       }     
  359.     
  360.       alert("User "+ quote + searchtext + quote + " could not be found in the "+ listName +"." );
  361.       return;
  362.     }
  363.  
  364.   function show(id)
  365.     {
  366.       if(document.getElementById)
  367.       {
  368.       document.getElementById(id).style.visibility = "visible";
  369.       document.getElementById(id).style.display = "block";
  370.       return 1;
  371.     }
  372.       else if(document.layers)
  373.       {
  374.         document.layers[id].visibility = "show";
  375.       document.layers[id].display = "block";
  376.       return 1;
  377.     }
  378.       else if(document.all)
  379.       {
  380.         document.all[id].style.visibility = "visible";
  381.       document.all[id].style.display = "block";
  382.       return 1;
  383.       }
  384.     return 0;
  385.     }
  386.     
  387.     function hide(id)
  388.     {
  389.       if(document.getElementById)
  390.       {
  391.       document.getElementById(id).style.visibility = "hidden";
  392.       document.getElementById(id).style.display = "none";
  393.       return 1;
  394.     }
  395.       else if(document.layers)
  396.       {
  397.       document.layers[id].visibility = "hide";
  398.       document.layers[id].display = "none";
  399.       return 1;
  400.     }
  401.       else if(document.all)
  402.       {
  403.         document.all[id].style.visibility = "hidden";
  404.       document.all[id].style.display = "none";
  405.       return 1;
  406.     }
  407.     return 0;
  408.     }